package com.test;

import java.util.Random;

import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class LabActivity extends Activity implements OnClickListener{
    /** Called when the activity is first created. */
	
	private String[] s;
	private static final Random ram = new Random();
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Button button = (Button) this.findViewById(R.id.button1);
        button.setOnClickListener(this);
        
    }

	public void onClick(View v) {
		Resources res = getResources();
		s = res.getStringArray(R.array.jokes);
		String str = s[ram.nextInt(s.length)];
		TextView tw = (TextView)findViewById(R.id.textView1);
		tw.setVisibility(0);
		tw.setText(str);
		
	}
}